package main

import (
	"fmt"
	"runtime"
)

func main() {
	//runtime.GOMAXPROCS(runtime.NumCPU())
	runtime.GOMAXPROCS(1)
	c := make(chan int)
	for i := 0; i < 10; i++ {
		//fmt.Println(i)
		go Go(c, i)
	}
	for v := range c {
		fmt.Println(v)
	}

}
func Go(c chan int, index int) {
	fmt.Println(index)
	a := 1
	for i := 0; i < 10000000; i++ {
		a += 1
	}
	fmt.Println(index, a)
	c <- index
	if index == 9 {
		//close(c)
	}
}
